<template>
  <div class="app-container">
    <el-form :model="form" label-width="140px">
      <el-form-item label="筛板脱落：">
        <el-radio-group v-model="form.plat" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="煤量过大：">
        <el-radio-group v-model="form.coalHigh" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="煤量分布不均：">
        <el-radio-group v-model="form.coalDistribution" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="筛分效率低：">
        <el-radio-group v-model="form.efficiency" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="电机温度报警：">
        <el-radio-group v-model="form.motor_temperature" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="传动轴温度报警：">
        <el-radio-group v-model="form.exciter_temperature" @change="sendData">
          <el-radio-button :label="true">是</el-radio-button>
          <el-radio-button :label="false" >否</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <el-divider />
      <p class="desc_text" style="text-indent:2em">
        软件系统模拟数据功能页面是一个用于模拟和生成测试数据的工具页面。为用户提供模拟数据生成、查询、错误处理和数据可视化等功能，帮助测试人员生成符合需求的模拟数据，以进行测试、验证和演示等工作。
      </p>
      <div class="desc_text">
        <ol>
          <li>
            筛板脱落：模拟前两块筛板脱落的情况，触发筛板脱落告警
          </li>
          <li>
            煤量过大：模拟筛机运行时，煤平均厚度过大，首页曲线图展示演示数据并触发告警
          </li>
          <li>
            煤量分布不均：将筛板分为左中右三块，模拟最高的一块与最低的一块落差比较大的情况，首页曲线图展示演示数据并触发告警
          </li>
          <li>
            筛分效率低：模拟筛机筛分效率低即末煤占比较高的情况，进行人工智能分析计算各类占比并触发告警
          </li>
          <li>
            电机温度告警：模拟电机温度，触发一条电机温度告警
          </li>
          <li>
            传动轴温度报警：模拟传动轴温度，触发一条传感器温度告警
          </li>
        </ol>
      </div>


    </el-form>
  </div>
</template>

<script setup name="BxIndex">

import { allSwitch,setData  } from "@/api/visualization/demo";

const { proxy } = getCurrentInstance();

const form = reactive({
  plat: false,
  coalLow: false,
  coalHigh: false,
  coalDistribution: false,
  efficiency: false,
  motor_temperature: false,
  exciter_temperature: false,
})

const data = {
  plat: false,
  coalLow: false,
  coalHigh: false,
  coalDistribution: false,
  efficiency: false,
  motor_temperature: true,
  exciter_temperature: true,
}

function initData(){
  allSwitch().then(resp => {
    form.plat = resp.data.plat ? resp.data.plat : false
    form.coalLow = resp.data.coalLow ? resp.data.coalLow : false
    form.coalHigh = resp.data.coalHigh ? resp.data.coalHigh : false
    form.coalDistribution = resp.data.coalDistribution ? resp.data.coalDistribution : false
    form.efficiency = resp.data.efficiency ? resp.data.efficiency : false
    form.motor_temperature = resp.data.motor_temperature ? resp.data.motor_temperature : false
    form.exciter_temperature = resp.data.exciter_temperature ? resp.data.exciter_temperature : false
  })
}

function sendData(){
  setData(form).then(resp => {
    proxy.$modal.msgSuccess("操作成功");
  })
}

onMounted(() => {
  initData()
})
</script>

<style scoped>

.desc_text {
  color: gray;
}
</style>